﻿// ==UserScript==
// @name        doodle-gone
// @namespace   https://user-web.googlecode.com/
// @description Replace the Google logo with a hosted image
// @version     2
// @include     http://*.google.*/*
// @include     https://*.google.*/*
// @grant       GM_getResourceURL
// ==/UserScript==
try {
    remove(document.getElementsByName("btnI")); //lucky button
    remove(document.getElementById("fsl")); // Advertising Business About
    remove(document.getElementsByClassName("_Gs")[1]); //terms
    remove(document.getElementsByClassName("_Gs")[0]); //privacy
    remove(document.getElementsByClassName("gb_Fc"));  // g+ gmail images
    remove(document.getElementsByClassName("gb_Tb"));  // "+" share button in top right


    remove(document.getElementById('hplogo'));

    document.getElementById('searchform').style.top = "500px";
    /*
	// @resource    logo https://www.google.co.uk/images/srpr/logo11w.png
    var oldLogo = document.getElementById('hplogo');
    var newLogo = document.createElement('img');
    newLogo.id = "User-Logo";
    newLogo.border = 'no'
    newLogo.style.height = "95px";
    newLogo.style.width = "269px";
    newLogo.src = GM_getResourceURL ("logo");
    oldLogo.parentNode.replaceChild(newLogo, oldLogo);
    */

}
catch (ex) {
    log(ex.message);
}

function remove(el) {
    if (el != null) {
        // log(1);
        // log(el.constructor);
        // log(typeof(el));
        // log(el.length);

        if (el.length) {
            // log(2)
            for (var i = 0; i < el.length; i++) {
                // log(3);
                remove(el[i]);
            }
        }
        else {
            // log(4);
            el.parentNode.removeChild(el);
        }
    }
}

function log(msg) {
    console.log("[doodle-gone] " + msg);
}